package main

import (
	"fmt"
	jcron "github.com/jakecoffman/cron"
	rcron "github.com/robfig/cron"
	"time"
)

const (
	D = iota
)

var msg = &Msg{}

type Msg struct {
	msg string
	it  int
}

func main() {

	var a uint = 60 /* 60 = 0011 1100 */
	var b uint = 13 /* 13 = 0000 1101 */
	var c uint = 0

	c = a & b /* 12 = 0000 1100 */
	fmt.Printf("Line 1 - Value of c is %d\n", c)

	c = a | b /* 61 = 0011 1101 */
	fmt.Printf("Line 2 - Value of c is %d\n", c)

	c = a ^ b /* 49 = 0011 0001 */
	fmt.Printf("Line 3 - Value of c is %d\n", c)

	c = a << 2 /* 240 = 1111 0000 */
	fmt.Printf("Line 4 - Value of c is %d\n", c)

	c = a >> 2 /* 15 = 0000 1111 */
	fmt.Printf("Line 5 - Value of c is %d\n", c, c == 15)
	now := time.Now().Local()
	fmt.Println(now)
	jc := jcron.New()
	jc.AddFunc("0/5 * * * * ?", Task1s, "task1")
	jc.AddFunc("0 0/30 * * * ?", TaskNhh, "task2")
	jc.Start()

	rc := rcron.New()
	rc.AddFunc("0 0/1 * * * ?", Task3m)
	rc.Start()
	//select {}
}
func Task1s() {
	fmt.Print(msg.msg)
	msg.it++
	msg.msg = "jc 10 s"
	fmt.Print(" ", msg.it, " ")
}

func Task3m() {
	fmt.Println()
	fmt.Println(msg.msg)
	msg.it++
	msg.msg = "3m3m3m3m"
	fmt.Print(" ", msg.it, " ")
}

func TaskNhh() {
	fmt.Println()
	fmt.Println(msg.msg)
	msg.it++
	msg.msg = "Nhh hh"
	fmt.Print(" ", msg.it, " ")
}
